package com.sakuraio.nextj.core.error.exception;

import com.sakuraio.nextj.core.error.Errors;
import com.sakuraio.nextj.core.protocol.ErrorDetails;

/**
 * <p>业务基础异常</p>
 *
 * @author nekoimi 2022/07/25
 */
public class BusinessException extends RuntimeException {
    /**
     * 异常信息
     */
    private final ErrorDetails errorDetails;

    public BusinessException() {
        super(Errors.BUSINESS_EXCEPTION.msg());
        this.errorDetails = Errors.BUSINESS_EXCEPTION;
    }

    public BusinessException(ErrorDetails errorDetails) {
        super(errorDetails.msg());
        this.errorDetails = errorDetails;
    }

    public ErrorDetails errorDetails() {
        return errorDetails;
    }
}
